<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
	<title>用户注册</title>
	<link rel="stylesheet" href="#(path)/dist/css/screen.css">
	<script src="#(path)/js/jquery-3.2.0.min.js"></script>
	<script src="#(path)/js/jquery.validate.min.js"></script>
	<link rel="stylesheet" href="#(path)/dist/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" href="#(path)/dist/css/AdminLTE.min.css">
	<link rel="stylesheet" href="#(path)/dist/plugins/iCheck/square/blue.css">
</head>
<style type=text/css>
body {
	background: #fff url(#(path)/dist/img/bg.jpg) no-repeat left top;
	background-size: 100%;
}
</style>
<script>
	$().ready(function() {
		// validate the comment form when it is submitted
		$("#commentForm").validate();

		// validate signup form on keyup and submit
		$("#signupForm").validate({
			rules : {
				realname : "required",
				phone : {
					required : true,
					minlength : 11
				},
				password : {
					required : true,
					minlength : 6
				},
				confirm_password : {
					required : true,

					equalTo : "#password"
				},

				topic : {
					required : "#newsletter:checked",
					minlength : 2
				},
				agree : "required"
			},
			messages : {
				realname : "请输入你的用户名",
				phone : {
					required : "请输入11位号码",
					minlength : "输入长度不能少于11位！"
				},
				password : {
					required : "请输入6位密码！",
					minlength : "输入密码不能少于6位数！"
				},
				confirm_password : {
					required : "请重新输入密码",
					equalTo : "输入密码不一致！"
				},
			}
		});
	});
</script>
</head>
<body>
	<div class="register-box">
		<div class="register-logo">
			<img src="#(path)/dist/img/logo.png" width=300px;>
		</div>

		<div class="register-box-body"
			style="padding-bottom: 20px; border-radius: 10px;">
			#if(msg)
			<p class="login-box-msg" style="color: #930000">#(msg)</p>
			#end
			<div id="main">
					<div class="form-group has-feedback">
						<span class="glyphicon glyphicon-user form-control-feedback"></span>
						<input placeholder="姓名" class="form-control" id="realname"
							name="realname" type="text">
					</div>
					<div class="form-group has-feedback">
						<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
						<input placeholder="号码" class="form-control" id="phone"
							name="phone" type="text">
					</div>
					<div class="form-group has-feedback">
						<span class="glyphicon glyphicon-lock form-control-feedback"></span>
						<input placeholder="密码" class="form-control" id="password"
							name="password" type="password">
					</div>
					<div class="form-group has-feedback">
						<span class="glyphicon glyphicon-log-in form-control-feedback"
							for="confirm_password"></span> <input placeholder="重输号码"
							class="form-control" id="confirm_password"
							name="confirm_password" type="password">

					</div>
					<div class="form-group has-feedback">
						<input type="submit" class="btn btn-success btn-block btn-flat" value="开始注册">
						<button onclick="location.href='#(path)/user/login'" class="btn btn-primary btn-block btn-flat">返回登陆</button>
					</div>
			</div>
		</div>
	</div>
	<script src="#(path)/dist/plugins/jQuery/jquery-2.2.3.min.js"></script>
	<script src="#(path)/dist/bootstrap/js/bootstrap.min.js"></script>
	<script src="#(path)/dist/js/elink.js"></script>
	<script src="#(path)/dist/plugins/layer/layer.js"></script>
	<script>
	$(function() {
			$('.submit').click(function(){
				ajax("#(path)/user/reg",
						{"realname ":$('#realname ').val(),"phone":$('#phone').val(),"password ":$('password ').val,}, function(data){
					if(data.code=='success'){
						layer.msg(data.msg, {icon:1},function(){
							// 注册成功，执行跳转...
							window.location.href="#(path)/user/login";
						});
					}else if(data.code=='error'){
						layer.msg(data.msg, {icon:2},function(){
							// 登陆失败，提醒错误...
						});
					}
				});
			});
	});
	</script>
</body>
</html>
